#include "mythread.h"

myThread::myThread(QObject *parent) :QThread(parent)
{
    flag = false;//线程是停止的
}
void myThread::setMsg(QString msg){
    this->msg = msg;
}
//子线程的入口
void myThread::run(){
    forever{
        if(flag){//flag::true 线程停止
        flag = false;
        break;
        }
        qDebug()<<this -> msg;
        QThread::sleep(1);
    } //for(;;)
    return;
}
void myThread:: stop(){
    flag = true;
}
